<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>编辑文章</title>
    <link rel="stylesheet" href="{{ url_for('static', filename='css/bootstrap.min.css') }}">
</head>
<body>
    <div class="admin-header">
        <h1>"{{ nickname }}"的博客管理面板</h1>
    </div>

    <div class="content-container">
        <div class="sidebar">
            <!-- 保持与articles.html相同的菜单结构 -->
        </div>

        <div class="main-content">
            <div class="content-header">编辑文章</div>
            
            <form method="POST">
                <div class="mb-3">
                    <label class="form-label">标题</label>
                    <input type="text" class="form-control" name="title" 
                           value="{{ article.title }}" required>
                </div>

                <div class="mb-3">
                    <label class="form-label">分类</label>
                    <select class="form-select" name="category_id">
                        <option value="">无分类</option>
                        {% for category in categories %}
                        <option value="{{ category.id }}" 
                            {% if category.id == article.category_id %}selected{% endif %}>
                            {{ category.name }}
                        </option>
                        {% endfor %}
                    </select>
                </div>

                <div class="mb-3">
                    <label class="form-label">内容</label>
                    <textarea class="form-control" name="content" 
                              rows="15" required>{{ article.content }}</textarea>
                </div>

                <button type="submit" class="btn btn-primary">保存修改</button>
                <a href="{{ url_for('admin.admin_articles') }}" 
                   class="btn btn-secondary">取消</a>
            </form>
        </div>
    </div>

    <script src="{{ url_for('static', filename='js/bootstrap.bundle.min.js') }}"></script>
</body>
</html>